import {Service} from "adajs";

class NewsService extends Service {
    defaultData() {
        return {
            isLoad: false,
            newsInfo: {
                "data": {
                    "yhid": "f9c01708-012b-44c7-91e5-68fceeb2e308",
                    "poXm": "李四",
                    "poSex": "1b764b71-aeb8-4121-9c6b-208d5c6f97b9",
                    "poBirthday": "1924-10-03",
                    "poPresent": "6420653e-75d8-424f-953f-390dc70859e6",
                    "poPost": "天娱传媒",
                    "poPhone": "18756231596",
                    "oldperson": {
                        "xm": "邓紫棋",
                        "sex": "女",
                        "post": "呼伦贝尔海拉尔创业局",
                        "retiredType": "离休",
                        "retiredPost": "其他",
                        "jg": "香港九龙",
                        "szdzb": "一支部",
                        "age": 70,
                        "id": "f9c01708-012b-44c7-91e5-68fceeb2e308"
                    },
                    "oldpersonchildrenList": [],
                    "id": "8a1433f5-d206-4b2a-9fc5-39faad53f8dc"
                }, "code": "1", "msg": "", "timestamp": "20181223144753"
            },
            id: ""
        };
    }

    onupdate(current, id) {
        if (id) {
            return this.context.request.post("/api/lgb/app/lgb/oldperson/testament/details", {id}).then(({data}) => {
                current.id = id;
                current.isLoad = true;
                current.newsInfo = data;
            });
        }
    }
}

export default NewsService;